package model;

import controller.Controller;

import javax.swing.*;
import java.awt.*;

public class Card extends JLabel implements Comparable<Card> {
    private Controller controller;
    private Color color;
    private int number;
    private Image fontImage;
    private Image backImage;
    private String cardName;
//    public MouseLis mouseLis;
    public int getDrawHeight() {
        return drawHeight;
    }

    private int drawHeight;

    public String getCardName() {
        return cardName;
    }

    public void setCardName(String cardName) {
        this.cardName = cardName;
    }

    public int getCardX() {
        return cardX;
    }

    public void setCardX(int cardX) {
        this.cardX = cardX;
    }

    public int getCardY() {
        return cardY;
    }

    public void setCardY(int cardY) {
        this.cardY = cardY;
    }

    private boolean up;
    //设置牌的坐标
    private int cardX;
    private int cardY;
    //是否已经被点击
    private boolean clicked = false;

    private boolean isOnTop;
    private int distanceFromAxisY;

    public boolean isOnTop() {
        return isOnTop;
    }

    public void setOnTop(boolean onTop) {
        isOnTop = onTop;
    }

    public int getDistanceFromAxisY() {
        return distanceFromAxisY;
    }

    public void setDistanceFromAxisY(int distanceFromAxisY) {
        this.distanceFromAxisY = distanceFromAxisY;
    }

    public Card(String cardName, int number, boolean up, boolean isOnTop, int distanceFromAxisY,Controller controller) {
        this.controller = controller;
        this.number = number;
        this.cardName = cardName;
        this.up = up;
        this.isOnTop = isOnTop;
        this.distanceFromAxisY = distanceFromAxisY;
        fontImage = new ImageIcon("cards/" + this.cardName + "-" + this.number + ".jpg").getImage();
        backImage = new ImageIcon("cards/" + 55 + ".jpg").getImage();
//        mouseLis = new MouseLis(controller);
        addMouseListener(controller.mouseLis);
    }




    public Color getColor() {
        return color;
    }

    public void setColor(Color color) {
        this.color = color;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public Image getFontImage() {
        return fontImage;
    }

    public void setFontImage(Image fontImage) {
        this.fontImage = fontImage;
    }

    public Image getBackImage() {
        return backImage;
    }

    public void setBackImage(Image backImage) {
        this.backImage = backImage;
    }




    public boolean isUp() {
        return up;
    }

    public void setUp(boolean up) {
        this.up = up;
    }




    public boolean isClicked() {
        return clicked;
    }

    public void setClicked(boolean clicked) {
        this.clicked = clicked;
    }

    @Override
    public int compareTo(Card otherCard) {

        return Integer.compare(this.number, otherCard.number);
    }


    public void setDrawHeight(int i) {
    }
}


